#region Using

using System;
using System.Collections.Generic;
using BlogEngine.Core;
using BlogEngine.Core.Provider.Interfaces;

#endregion

namespace BlogEngine.Core.Provider.XML
{
	/// <summary>
	/// A storage provider for BlogEngine that uses XML files.
	/// <remarks>
	/// To build another provider, you can just copy and modify
	/// this one. Then add it to the web.config's BlogEngine section.
	/// </remarks>
	/// </summary>
	public class Provider : BlogProviderBase
	{
		private static string _folder = string.Empty;

		/// <summary>
		/// Gets the folder name.
		/// </summary>
		/// <value>The folder.</value>
		public static string Folder
		{
			get
			{
				if (string.IsNullOrEmpty(_folder))
				{
					string storage = BlogSettings.Instance.StorageLocation.Replace("~/", "");
					_folder = System.IO.Path.Combine(System.Web.HttpRuntime.AppDomainAppPath, storage);
				}

				return _folder;
			}
		}

		public Provider()
		{
			// TODO: use reflection to find and register the interfaces with their concrete implementations
//			Register(typeof(IPhotos), new CIPhotos());
//			Register(typeof(IAlbums), new CIAlbums());
//			Register(typeof(IPhotoEffects), new CIPhotoEffects());
			Register(typeof(IPosts), new CIPosts());
			Register(typeof(ICategories), new CICategories());
			Register(typeof(IPages), new CIPages());
			Register(typeof(ILinks), new CILinks());
			Register(typeof(IPingServices), new CIPingServices());
			Register(typeof(ISettings), new CISettings());
			//Register(typeof(IExtensionSettings), new CIExtensionSettings());
            Register(typeof(IPostContent), new CIPostContent());
		}

	}
}
